﻿/***************************************************************************
 *		ElGee Google Chart API Helper
 *		Copyright(C) 2011 by Laurent Geffroy lgeffroy@gmail.com
 * 
 *		This program is free software; you can redistribute it and/or 
 *		modify it under the terms of the GNU General Public License as
 *		published by the Free Software Foundation; either version 2 of 
 *		the License, or (at your option) any later version.
 *		
 *		This program is distributed WITHOUT ANY WARRANTY; without even the
 *		implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 *		See the GNU General Public License for more details.
 *	
 *      For particular licensing, please contact me at lgeffroy@gmail.com
 *****************************************************************************/

using System;
using System.Text;

namespace ElGee.Google.Charts
{
    /// <summary>
    /// Style for the Intensity Map
    /// </summary>
    public class IntensityMapStyle : BaseChartStyle
    {

        /// <summary>
        /// Gets or sets a value indicating whether [show one tab].
        /// The intensity map can display one or more numeric columns. Each column is displayed as a separate map, and tabs on top enable selection of which map to show. When the data table contains only one numeric column, the tabs are not displayed. To display tabs even for a single numeric column, set this option to true.
        /// </summary>
        /// <value><c>true</c> if [show one tab]; otherwise, <c>false</c>.</value>
        public bool ShowOneTab {get; set;}


        /// <summary>
        /// Gets or sets the type of the region.
        /// The required region. Possible values are: 'world', 'africa', 'asia', 'europe', 'middle_east', 'south_america', and 'usa'.
        /// </summary>
        /// <value>The type of the region.</value>
        public TypeOfRegion RegionType { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="IntensityMapStyle"/> class.
        /// </summary>
        public IntensityMapStyle() : base()
        {
            RegionType = TypeOfRegion.World;
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            string baseParams = base.ToString();
            if (!String.IsNullOrWhiteSpace(baseParams))
                sb.Append(baseParams).Append(",");

            // RegionType
            if ((RegionType != TypeOfRegion.World) && (RegionType != TypeOfRegion.Undefined))
                sb.Append("region: '").Append(RegionType.ToString().ToLower()).Append("',");

            // ShowOneTab
            if (ShowOneTab)
                sb.Append("showOneTab: true,");

            // Removing the last comma
            sb.Remove(sb.Length - 1, 1);

            return sb.ToString();
        }
    }
}
